<!-- 待授权：isAuthorizeding  授权未通过：isNoAuthorized  授权成功：isAuthorized -->
<!-- 待审核：isAuditing  审核未通过：isNoAudit  审核成功：isAudit -->
<template>
	<view>
		<view class="overlay" v-if="showPopup"></view>
		<view :class="(detail_type=='isAuditing'||detail_type=='isAuthorizeding')?'auditingcell pad':'auditingcell padNo'">
			<view class="auditing_header" v-if="isWeixin()==false">
				<view class="" v-if='isAudit==false'>
					赛事授权
				</view>
				<view class="" v-if='isAudit'>
					赛事审核
				</view>
				<uni-icons type="back" size="30" class="back" @tap.stop='back()'></uni-icons>
			</view>
			<view class="audit_content">
				<view class="acontent_header">
					 <view class="audit_time" v-if="isOrgInfo">
					 	送审时间
					 </view>
					 <view class="audit_time" v-if="isOrgInfo==false">
					 	未送审
					 </view>
					 <view class="">
					 	{{detail.createTime?detail.createTime:""}}
					 </view>
					 <view class="blue" v-if='detail_type=="isAuthorizeding"'>
						 待授权
					 </view>
					 <view class="red" v-if='detail_type=="isNoAuthorized"'>
							授权未通过
					 </view>
					 <view class="green" v-if='detail_type=="isAuthorized"'>
					 		已授权
					 </view>
					 <view class="blue" v-if='detail_type=="isAuditing"'>
					 		待审核
					 </view>
					 <view class="red" v-if='detail_type=="isNoAudit"'>
					 		审核未通过
					 </view>
					 <view class="green" v-if='detail_type=="isAudit"'>
							审核通过
					 </view>
				</view>
				<view class="msg_title">
					赛事信息
				</view>
				
				<view class="event_msg">
					<view class="msg_cell">
						<view class="cell_lt">
							赛事名称
						</view>
						<view class="cell_rt">
							{{detail.title?detail.title:""}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo">
						<view class="cell_lt">
							赛事联系人
						</view>
						<view class="cell_rt">
							{{detail.linkman?detail.linkman:""}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo">
						<view class="cell_lt">
							联系方式
						</view>
						<view class="cell_rt">
							{{detail.contact?detail.contact:""}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo">
						<view class="cell_lt">
							地址
						</view>
						<view class="cell_rt">
							{{detail.address_all?detail.address_all:""}}
						</view>
					</view>
					<view class="msg_cell" v-if="(detail_type=='isAuditing'||detail_type=='isNoAudit'||detail_type=='isAudit')&&detail.top_level!=null">
						<view class="cell_lt">
							赛事上报等级
						</view>
						<view class="cell_rt">
							{{detail.top_level}}
						</view>
					</view>
					<view class="msg_cell" v-if="(detail_type=='isAuthorizeding'||detail_type=='isNoAuthorized'||detail_type=='isAuthorized')&&detail.top_level!=null">
						<view class="cell_lt">
							限制上报等级
						</view>
						<view class="cell_rt">
							{{detail.top_level}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo==false">
						<view class="cell_lt">
							申请时间
						</view>
						<view class="cell_rt">
							{{detail.applyTime}}
						</view>
					</view>
					<view class="msg_cell" v-if='detail_type!="isAuditing"&&detail_type!="isAudit"&&detail_type!="isNoAudit"'>
						<view class="cell_lt">
							比赛时间
						</view>
						<view class="cell_rt">
							{{detail.gameTime}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo==false">
						<view class="cell_lt">
							上报截止时间
						</view>
						<view class="cell_rt">
							{{detail.deadline}}
						</view>
					</view>
					<view class="msg_cell" v-if="(detail_type=='isAuthorizeding'||detail_type=='isNoAuthorized'||detail_type=='isAuthorized')&&detail.multigroup!=null">
						<view class="cell_lt">
							允许报名多组
						</view>
						<view class="cell_rt">
							{{detail.multigroup}}
						</view>
					</view>
					<view class="msg_cell" v-if="(detail_type=='isAuthorizeding'||detail_type=='isNoAuthorized'||detail_type=='isAuthorized')&&detail.isopen!=null">
						<view class="cell_lt">
							公开参赛名单
						</view>
						<view class="cell_rt">
							{{detail.isopen}}
						</view>
					</view>
				<!-- 	<view class="msg_cell" v-if='detail.signUpCost!=null'>
						<view class="cell_lt">
							赛事报名费
						</view>
						<view class="cell_rt signupcost">
							{{detail.signUpCost}}
						</view>
					</view> -->
				</view>
				<view class="msg_title" v-if="detail_type=='isAuthorizeding'||detail_type=='isNoAuthorized'||detail_type=='isAuthorized'">
					申请机构信息
				</view>
				<view class="event_msg" v-if="detail_type=='isAuthorizeding'||detail_type=='isNoAuthorized'||detail_type=='isAuthorized'">
					<view class="msg_cell" v-if="isOrgInfo">
						<view class="cell_lt">
							申请机构
						</view>
						<view class="cell_rt">
							{{detail.org_name?detail.org_name:"暂无"}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo">
						<view class="cell_lt">
							机构联系人
						</view>
						<view class="cell_rt">
							{{detail.chessLinkman?detail.chessLinkman:"暂无"}}
						</view>
					</view>
					<view class="msg_cell" v-if="isOrgInfo">
						<view class="cell_lt">
							联系方式
						</view>
						<view class="cell_rt">
							{{detail.chesscontact?detail.chesscontact:"暂无"}}
						</view>
					</view>
				</view>
				
				<view class="audit_advance">
					<view class="advance_cell" @tap.stop="eventRules()">
						<view class="cell_lt">
							竞赛规程
						</view>
						<view class="cell-rt">
							<!-- <uni-icons type="arrowright" size="20" class="next"></uni-icons> -->
							 <view class="msfont ms-right"></view>
						</view>
					</view>
					<view class="advance_cell" @tap.stop="checkGroup()">
						<view class="cell_lt">
							报名小组
						</view>
						<view class="cell-rt" >
							<!-- <uni-icons type="arrowright" size="20" class="next"></uni-icons> -->
							<view class="msfont ms-right"></view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="auditcell_title" v-if="checkOption.length>0&&detail_type!='isAuditing'">审核进度</view>
			 <view class="div-bg bg-white" v-if="checkOption.length>0&&detail_type!='isAuditing'">
			    <!--物流跟踪-->
			    <view style="padding-bottom: 0.5rem;">
			      <view class="bg-white">
			        <view>
			          <view class="track-rcol">
			            <view class="track-list">
			              <ul>
			              <view>
			                <li  class="finall'" v-for='(item,index) in checkOption' :key='index'>
			                  <view class="node-icon"></view>
												<view :class="(index==checkOption.length-1)?'progress no_border':'progress'"></view>
												<view class="check_status">
													<view class="check_title" v-if='item.check_state==0||item.state==1'>
														审核不通过
													</view>
													<view class="check_title" v-if='item.check_state==1||item.state==2'>
														审核通过
													</view>
													<view class="check_title" v-if='item.check_state==2'>
														审核中
													</view>
													<view class="check_step" v-if="item.check_state==0||item.state==1">
														{{item.org_name?item.org_name:""}}不同意
													</view>
													<view class="check_step" v-if='item.check_state==1||item.state==2'>
														{{item.org_name?item.org_name:""}}同意
													</view>
													<view class="check_step" v-if='item.check_state==2'>
														{{item.org_name?item.org_name:""}}审核中...
													</view>
													<view class="check_date">
														{{item.createTime?item.createTime:""}}
													</view>
												</view>
			                </li>
			              </view>
			              </ul>
			            </view>
			          </view>
			        </view>	
			      </view>
			    </view>
			  </view>
				
			
			<!-- 待审核 -->
			<view class="auditing_footer" v-if='(detail_type=="isAuthorizeding"&&isOrgInfo)||detail_type=="isAuditing"'>
				<button  size="mini" class="btns" plain="true" @click="notAgree()">拒绝</button>
				<button  size='mini' class="btns" @click="agree()">同意</button>
			</view>
			
		</view>
		
			<uni-popupChecking
				:popup="popupData"
				:isAuditing='isAuditing'
				:showPopup="showPopup"
				@toAgree='popupAgree'
				@toNotAgree='popupNotAgree'
				@toCancel="toCancel"
				class="popupchecking"
				>
		</uni-popupChecking>
	</view>
</template>

<script>
	import uniPopupChecking from "@/components/uni-event/uni-popupchecking.vue";
	export default{
		data(){
			return{
				isAudit:false,//是否为审核页面
				showPopup:false,
				popupData:{},
				isAuditing:false,
				showpopup:false
			}
		},
		props:{
			detail_type:String,
			detail:Object,
			checkOption:Array,
			isCheckStep:Boolean, //是否显示审核进度
			isOrgInfo:Boolean,  //判断数据来源
		},
		components:{
			uniPopupChecking
		},
		onShow() {
			var _this=this;
			_this.getNewPage();
			// 				// _this.$refs.popups.open();
			// console.log(_this.detail_type)
		},
		methods:{
			 isWeixin () {
				try{
				 	var ua = navigator.userAgent.toLowerCase();
				 	if (ua.match(/MicroMessenger/i) == "micromessenger") {
				 		return true;
				 	}
						return false;
					}catch(e){
						//TODO handle the exception
						return true;
					}
			  },
			//判断详情类型
			getNewPage(){
				var _this=this;
				switch(_this.detail_type){
					case "isAuthorizeding"||"isNoAuthorized"|"isAuthorized":
						return _this.isAudit=false
					case "isAuditing"||"isNoAudit"||"isAudit":
						return _this.isAudit=true;
				}
			},
			//查看竞赛规程
			eventRules(){
				var _this=this;
				_this.$emit('eventRules')
			},
			checkGroup(){
				var _this=this;
				_this.$emit("checkGroup")
			},
			back(){
				var _this=this;
				_this.$emit('back')
			},
			//点击同意
			agree(){
				var _this=this;
				_this.isCheckRules=false;
				_this.showPopup=true;
				_this.isAuditing=true;
				_this.popupData={
					isAgree:true,
					cancelMsg:"取消",
					confirmMsg:"确认",
					isPopupHeader:true,
					isPopupInput:false,
					isPopupFooter:true,
					isPopupContent:true,
					content:_this.detail.org_name,
					title:'审核同意'
				}
			},
			//点击不同意
			notAgree(){
				var _this=this;
				_this.showPopup=true;
				_this.isCheckRules=false;
				_this.isAuditing=true;
				_this.popupData={
					isAgree:false,
					cancelMsg:"取消",
					confirmMsg:"拒绝",
					isPopupHeader:true,
					isPopupInput:true,
					isPopupFooter:true,
					isPopupContent:true,
					content:_this.detail.org_name,
					title:'审核拒绝'
				}
				// _this.$refs.popups.open();
			},
			popupAgree(){
				var _this=this;
				// _this.$refs.popups.close();
				this.$emit("toPopupAgree");
				setTimeout(function(){
					_this.showPopup=false;
				},500)
			},
			popupNotAgree(txtReason){
				var _this=this;
				if(txtReason!=null){
					this.$emit("toPopupNotAgree",txtReason);
					setTimeout(function(){
						_this.showPopup=false;
					},500)
				}else{
					uni.showToast({
						title:'请输入拒绝理由！',
						icon:"none"
					})
				}
			},
			toCancel(){
				var _this=this;
				_this.showPopup=false;
			},
			cancelOverlay(){
				this.showPopup=false;
			}
		}
	}
</script>

<style lang="less" scoped>
@import url("../../static/iconfont/iconfont.css");
	.padNo{
		padding-bottom: 0;
	}
	.pad{
		padding-bottom: 90rpx;
	}
	.auditingcell{
		background: #F6F7F9;
		font-size: 28rpx;
		.blue{
			color: #2D8DFF;
		}
		.red{
			color: #FF535A;
		}
		.green{
			color: #81D25A;
		}
	}
	.auditing_header{
		position: relative;
		padding: 10rpx 0;
		font-size: 36rpx;
		text-align: center;
		background: #fff;
		border-bottom: 2rpx solid #F1F1F2;
		.back{
			position: absolute;
			left: 0;
			top: 0;
		}
	}
	.next{
		color: #8E8E93;
	}
	.audit_content{
		// background: #fff;
	}
	.acontent_header{
		display: flex;
		flex-direction: row;
		height:56rpx;
		padding: 22rpx 0;
		padding-right: 32rpx;
		background: #fff;
		line-height: 56rpx;
		justify-content: space-between;
		.audit_time{
			background:#2D8DFF;
			// font-size: 14rpx;
			width:182rpx;
			border-radius:0rpx 28rpx 28rpx 0rpx;
			line-height: 56rpx;
			color: #fff;
			text-align: center;
		}
		view:nth-of-type(2){
			color: #8E8E93;
			margin-left: -20rpx;
		}
	}
	.msg_title{
		padding: 16rpx 0;
		font-size: 32rpx;
		background: #F6F7F9;
		padding-left: 32rpx;
	}
	.event_msg{
		display: flex;
		flex-direction: column;
		padding: 0 32rpx;
		background: #fff;
		.msg_cell{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			padding: 24rpx 0;
			border-bottom: 2rpx solid #F1F1F2;
			color: #8E8E93;
			.cell_lt{
				width: 27%;
			}
			.signupcost{
				color: red;
			};
			.cell_rt{
				width: 73%;
				text-align: right;
			}
		}
	}
	.audit_advance{
		margin-top: 24rpx;
		background: #fff;
		padding: 0 32rpx;
		.advance_cell{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			padding: 24rpx 0;
			border-bottom: 2rpx solid #F1F1F2;
		}
		.advance_cell:last-child{
			border-bottom: none;
		}
	}
	.popupchecking{
		position: fixed;
		bottom: 0;
		background: #fff;
		width: 100%;
		z-index: 1000;
	}
	.auditing_footer{
		position: fixed;
		width: 100%;
		bottom: 20rpx;
		display: flex;
		flex-direction: row;
		// height: 88rpx;
		.btns{
			// font-size: 28rpx;
			width: 45%;
			text-align: center;
			// line-height:88rpx;
		}
		.btns:first-child{
			border: 2rpx solid #2D8DFF;
			color: #2D8DFF;
			background: #fff;
		}
		.btns:last-child{
			background:  #2D8DFF;
			color: #fff;
		}
	}
	.auditcell_title{
		padding: 24rpx 32rpx;
		font-size: 32rpx;
		background: #fff;
		margin-top: 24rpx;
	}
	//审核进度
	.bg-white{
		margin: auto;
		padding-left: 24rpx;
		padding-right: 24rpx;
		font-size: 28rpx;
		background: #fff;
	}
	.check_status{
		font-size: 28rpx;
		.check_title{
			font-size: 32rpx;
			color: #000;
			padding-top: 0;
		}
		.check_step{
			margin-top: 16rpx;
		}
		.check_date{
			margin-top: 16rpx;
			padding-bottom: 24rpx;
		}
	}
	.progress{
		width: 2rpx;
		background: #2D8DFF;
		height: 100%;
		position: absolute;
		top: 16rpx;
		left: 0;
		margin-left: -2.8rpx;
	}
	.no_border{
		width: 0;
		display: none;
	}
	.message-text{
	    font-family: MicrosoftYaHei;
	    font-size: 1rem;
	    font-weight: normal;
	    font-stretch: normal;
	    line-height: 3rem;
	    letter-spacing: 0rem;
	    color: #333333;
	    width: 50%;
	  }
	  .fontblack{
	    color:#999999
	  }
	  .img2{
	    width: .81rem;
	    height: .8rem;
	    float: right;
	  }
	  .addressshow2{
	    height: auto;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    display: -webkit-box;
	    width: 75%;
	    -webkit-line-clamp: 2;
	    -webkit-box-orient: vertical;
	    white-space: normal;
	    word-wrap: break-word;
	    word-break: break-all;
	    font-size: 1rem;
	  }
	  .addressshow1{
	    height: auto;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    display: -webkit-box;
	    width: 75%;
	    -webkit-line-clamp: 1;
	    -webkit-box-orient: vertical;
	    white-space: normal;
	    word-wrap: break-word;
	    word-break: break-all;
	    font-size: 1rem;
	  }
	  .orderTitle{
	    font-size: 1rem;
	    color: #333333;
	    height: auto;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    display: -webkit-box;
	    -webkit-line-clamp: 2;
	    -webkit-box-orient: vertical;
	    white-space: normal;
	    word-wrap: break-word;
	    word-break: break-all;
	    height: 2.5rem;
	  }
	  .orderDetail{
	    font-size: 0.8rem;
	    color: #666666;
	    text-align:left;
	  }
	  .border-ceter{
	    width: 92%;
	    // padding: 0 16rpx;
			background: #fff;
	  }
	  .pay-button{
	    width: 88%;
	    height: 2.6rem;
	    position:relative;
	    background-color: red;
	    color: white;
	
	    margin-left: 6%;
	  }
	  ul li{
	    list-style:none;
	    font-size:1rem;
	  }
	  ul {
	    padding-left: 0;
	  }
	  .track-rcol{}
	  .track-list{
	    position:relative;
	  }
	  .track-list li{
	    position:relative;
			padding-left: 40rpx;
	    color: #999;
	  }
	  .track-list li.first{
	    color:red;
	    padding-top:0;
	    width:100%;
	    text-align:left;
	    // border-left:1rpx solid #2D8DFF;
	  }
	  .track-list li .node-icon{
	    position: absolute;
	    left: -11rpx;
	    border-radius: 0.25rem;
	    width: 16rpx;
	    height: 16rpx;
	    top:14rpx;
	    background-color: #2D8DFF;
	  }
	  .track-list li.first .node-icon{
	    background-position:0-144rpx;
	    background-color: #2D8DFF;
	    width: 16rpx;
	    z-index: 2;
	    height: 16rpx;
	    position: absolute;
	    // left: -9rpx;
	    top: 14rpx;
	    border-radius: 0.5rem;
	  }
	  .track-list li .time{
	    margin-right:40rpx;
	    position:relative;
	    top:8rpx;
	    display:inline-block;
	    vertical-align:middle;
	    background-color: white;
	    color: #999;
	    width:100%;
	    text-align:left;
	  }
	  .track-list li .txt{
	    position:relative;
	    display:inline-block;
	    vertical-align:top;
	    color: #999;
	  }
	  .track-list li.first .time{
	    text-align: left;
	    width: 94%;
	    color:red;
	  }
	  .track-list li.first .txt{
	    color: red;
	    text-align:left;
	    width: 94%;
	  }
	  .track-list li.finall{
	    position:relative;
	    // padding:0rpx 0 1.5rem 25rpx;
	    line-height:36rpx;
	    // border-color :white;
	    // border-left:1rpx solid #ffffff;
	    color: #999;
	  }
		.overlay{
			position: fixed;
			width: 100%;
			height: 100%;
			left: 0;
			top: 0;
			opacity: 0.7;
			background:rgba(0,0,0,0.4);
		}
</style>
